/**
 * Licensee: DuKe TeAm
 * License Type: Purchased
 */
package ormsamples;

import org.orm.*;
public class RetrieveAndUpdateEvaluacionDocenteData {
	public void retrieveAndUpdateTestData() throws PersistentException {
		PersistentTransaction t = orm.EvaluacionDocentePersistentManager.instance().getSession().beginTransaction();
		try {
			orm.DAOFactory lDAOFactory = orm.DAOFactory.getDAOFactory();
			orm.dao.EvaluacionDAO lormEvaluacionDAO = lDAOFactory.getEvaluacionDAO();
			orm.Evaluacion lormEvaluacion = lormEvaluacionDAO.loadEvaluacionByQuery(null, null);
			// Update the properties of the persistent object
			lormEvaluacionDAO.save(lormEvaluacion);
			orm.dao.RegionDAO lormRegionDAO = lDAOFactory.getRegionDAO();
			orm.Region lormRegion = lormRegionDAO.loadRegionByQuery(null, null);
			// Update the properties of the persistent object
			lormRegionDAO.save(lormRegion);
			orm.dao.ComunaDAO lormComunaDAO = lDAOFactory.getComunaDAO();
			orm.Comuna lormComuna = lormComunaDAO.loadComunaByQuery(null, null);
			// Update the properties of the persistent object
			lormComunaDAO.save(lormComuna);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public void retrieveByCriteria() throws PersistentException {
		System.out.println("Retrieving Evaluacion by EvaluacionCriteria");
		orm.EvaluacionCriteria evaluacionCriteria = new orm.EvaluacionCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//evaluacionCriteria.ev_id.eq();
		System.out.println(evaluacionCriteria.uniqueEvaluacion());
		
		System.out.println("Retrieving Region by RegionCriteria");
		orm.RegionCriteria regionCriteria = new orm.RegionCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//regionCriteria.re_numeroregion.eq();
		System.out.println(regionCriteria.uniqueRegion());
		
		System.out.println("Retrieving Comuna by ComunaCriteria");
		orm.ComunaCriteria comunaCriteria = new orm.ComunaCriteria();
		// Please uncomment the follow line and fill in parameter(s)
		//comunaCriteria.co_id.eq();
		System.out.println(comunaCriteria.uniqueComuna());
		
	}
	
	
	public static void main(String[] args) {
		try {
			RetrieveAndUpdateEvaluacionDocenteData retrieveAndUpdateEvaluacionDocenteData = new RetrieveAndUpdateEvaluacionDocenteData();
			try {
				retrieveAndUpdateEvaluacionDocenteData.retrieveAndUpdateTestData();
				//retrieveAndUpdateEvaluacionDocenteData.retrieveByCriteria();
			}
			finally {
				orm.EvaluacionDocentePersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
